/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements.  See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.rtx.ui.component.theme;

import im.rtx.base.service.ThemeService;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.swing.*;

/**
 * Project  : im.rtx.ui.component.theme
 * Author   : solosky < solosky772@qq.com >
 * Created  : 2014/10/18
 * License  : Apache License 2.0
 */
public class ThemeResources {
    /**
     * Root pane styling icons.
     */
    public static ImageIcon skinIcon = null;
    public static ImageIcon skinActiveIcon = null;
    public static ImageIcon settingIcon = null;
    public static ImageIcon settingActiveIcon = null;
    public static ImageIcon minimizeIcon = null;
    public static ImageIcon minimizeActiveIcon = null;
    public static ImageIcon maximizeIcon = null;
    public static ImageIcon maximizeActiveIcon = null;
    public static ImageIcon restoreIcon = null;
    public static ImageIcon restoreActiveIcon = null;
    public static ImageIcon closeIcon = null;
    public static ImageIcon closeActiveIcon = null;


    public static void load(ThemeService themeService){
        skinIcon = themeService.getImageIcon("base/window/skin");
        skinActiveIcon = themeService.getImageIcon("base/window/skinActive");
        settingIcon = themeService.getImageIcon("base/window/setting");
        settingActiveIcon = themeService.getImageIcon("base/window/settingActive");
        minimizeIcon = themeService.getImageIcon("base/window/minimize");
        minimizeActiveIcon = themeService.getImageIcon("base/window/minimizeActive");
        maximizeIcon = themeService.getImageIcon("base/window/maximize");
        maximizeActiveIcon = themeService.getImageIcon("base/window/maximizeActive");
        restoreIcon = themeService.getImageIcon("base/window/restore");
        restoreActiveIcon =  themeService.getImageIcon("base/window/restoreActive");
        closeIcon =  themeService.getImageIcon("base/window/close");
        closeActiveIcon = themeService.getImageIcon("base/window/closeActive");
    }

    @Service
    @Order
    public static class ThemeResourceLoader{
        @Resource
        private ThemeService themeService;
        @PostConstruct
        public void init(){
            load(themeService);
        }
    }
}
